﻿using System.Collections.Generic;
using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.CG.Dto;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.CG
{
    [Authorize]
    [ApiController]
    [Route("api/cg")]
    public class CGController : BPMReportPlatformController
    {
        private readonly ICGOrderService _CGOrderService;


        public CGController(ICGOrderService cGOrderService)
        {
            _CGOrderService = cGOrderService;
        }

        /// <summary>
        ///立邦包装外观与色彩打印申请 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("BZWGYSDY/GetAllAsync")]
        public async Task<PagedResultDto<GetBZWGYSDYOutput>> GetAllAsync([FromBody] BZWGYSDYInput input)
        {
            return await _CGOrderService.GetAllAsync(input);
        }

        /// <summary>
        /// 立邦包装外观与色彩打印申请  导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("BZWGYSDY/ExportAsync")]
        public async Task<XlsxFileResult<GetBZWGYSDYOutput>> ExportAsync([FromBody] BZWGYSDYInput input)
        {
            var rst = await _CGOrderService.ExportAsync(input);
            var result = new List<GetBZWGYSDYOutput>();
            return new XlsxFileResult<GetBZWGYSDYOutput>(ObjectMapper.Map(rst, result), "导出Excel");
        }

        /// <summary>
        ///SRM订单加急付款申请表 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("SRMDDJJFKSQB/GetAllAsync")]
        public async Task<PagedResultDto<GetSRMDDJJFKSQBOutput>> GetAllAsync([FromBody] SRMDDJJFKSQBInput input)
        {
            return await _CGOrderService.GetAllAsync(input);
        }

        /// <summary>
        /// SRM订单加急付款申请表  导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("SRMDDJJFKSQB/ExportAsync")]
        public async Task<XlsxFileResult<GetSRMDDJJFKSQBOutput>> ExportAsync([FromBody] SRMDDJJFKSQBInput input)
        {
            var rst = await _CGOrderService.ExportAsync(input);
            var result = new List<GetSRMDDJJFKSQBOutput>();
            return new XlsxFileResult<GetSRMDDJJFKSQBOutput>(ObjectMapper.Map(rst, result), "导出Excel");
        }

        /// <summary>
        /// 新90单TU报表 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("New90/GetAllAsync")]
        public async Task<PagedResultDto<GetNew90Output>> GetAllAsync([FromBody] New90Input input)
        {
            return await _CGOrderService.GetAllAsync(input);
        }

        /// <summary>
        /// 新90单TU报表  导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("New90/ExportAsync")]
        public async Task<XlsxFileResult<GetNew90Output>> ExportAsync([FromBody] New90Input input)
        {
            var rst = await _CGOrderService.ExportAsync(input);
            var result = new List<GetNew90Output>();
            return new XlsxFileResult<GetNew90Output>(ObjectMapper.Map(rst, result), "导出Excel");
        }
    }
}